<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>用户列表</title>
</head>
<body>
在JSP中使用raw jdbc和JSP片段进行数据库查询
	<table>
		<tr>
			<td>uid</td>
			<td>用户名</td>
			<td>姓名</td>
		</tr>
		<%
			Connection conn = null;
			Class.forName("com.mysql.jdbc.Driver");
			conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/mytest", "root", "123456");
			Statement stmt = conn.createStatement();
			String sql = "select uid,username,truename from member";
			ResultSet rs = stmt.executeQuery(sql);
			while (rs.next()) {
		%>
		<tr>
			<td><%=rs.getInt("uid")%></td>
			<td><%=rs.getString("username")%></td>
			<td><%=rs.getString("truename")%></td>
		</tr>
		<%
			}
			if (conn != null)
				conn.close();
		%>
	</table>
</body>
</html>